package com.example.venue_reservation_service.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

/**
 *
 * @TableName venue_payment
 */
@TableName(value ="venue_payment")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Payment implements Serializable {
    /**
     * 编号
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 用户编号
     */
    private Integer userId;

    /**
     * 交易金额
     */
    private Double amount;

    /**
     * 支付情况：
     * 支出：用户花费账户积分
     * 支入：账户积分增加（充值）
     * 超时：用户未在预约时间进行签到
     * 取消：用户取消预约订单
     */
    private String situation;

    /**
     * 交易时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime time;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    public Payment(Integer userId, Double amount, String situation, LocalDateTime time) {
        this.userId = userId;
        this.amount = amount;
        this.situation = situation;
        this.time = time;
    }
}